<?php

namespace App\Http\Middleware;

use App\Enums\AdminTypeEnum;
use App\Exceptions\PowerException;
use App\Managers\Admin\AdminUsersManager;
use App\Models\Projects\ProjectsAdminUserModel;
use App\Models\Projects\ProjectsModel;
use App\Util\LoginUtil;
use App\Util\ProjectUtil;
use Closure;
use Illuminate\Http\Request;

class ChatGuards
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse)  $next
     * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
     */
    public function handle(Request $request, Closure $next)
    {
            $guards = "chat";
            $request->merge(['guards'=>$guards]) ;
            $request->route()->controller?->getServices()->setData("guards", $guards);

            return $next($request);
    }
}
